"use strict";
import {
	login,
	getUserInfo,
	getMobile,
} from '@/api/user.js'
import db from "@/system/core/nardy.db.js";
const state = {
	userInfo:{},
	order_count:{},
};

const getters = {

};

const actions = {
	async getUserInfo({commit},params) {
		this.$win.loading("加载中")
		let res = await getUserInfo(params);
		if(res && res.errcode==0){
			commit("set_user",res.userInfo)
			commit("order_count",res.order_count)
			this.$win.close("l")
			return res
		}else{
			this.$win.nlog(res.description)
		}
	},
};

const mutations = {
	set_user(state,data){
		state.userInfo = data
	},
	set_token(state,data){
		state.token = data
	},
	order_count(state,data){
		state.order_count = data
	},
};

export default {
	namespaced: true, //默认为false。默认情况下，模块的action，mutation和getter是注册在全局的命名空间的， 这里设置为true后，action,muation和getter等都以模块名称进行调用，
	state,
	getters,
	actions,
	mutations
}
